package com.wamke.controller;


import com.wamke.pojo.Dept;
import com.wamke.pojo.DeptDTO;

import com.wamke.pojo.PageBean;
import com.wamke.pojo.Result;
import com.wamke.service.DeptService;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @program: wanke
 * @ClassName DeptController
 * @author: WXK
 * @create: 2023-10-21 14:56
 **/
@RestController
@RequestMapping("/dept")
@Slf4j
public class DeptController {

    @Autowired
    private DeptService deptService;


    @GetMapping("/selectAll")
    public Result<PageBean> pageBean (DeptDTO deptDTO){
        PageBean pageBean = deptService.selectCondition(deptDTO);
        return Result.success(pageBean);
    }

    @DeleteMapping("/{id}")
    public Result delete(String id ){

        deptService.deleteById(id);
        return Result.success();
    }
}
